package com.xiaoyao.novel.dao;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import com.xiaoyao.novel.pojo.Book;

public class BookDao extends BaseDao<Book> {

	public void calcClick(Map<String, Integer> map) throws SQLException {
		session.update(PREFIX + "updateClick", map);
	}
	
	@SuppressWarnings("unchecked")
	public List<Book>  getAllBook() throws SQLException{
		return session.queryForList(PREFIX +"getAllBook");
	}

	public void calcClick(List<Map<String, Integer>> mapList) throws SQLException {
//		session.startTransaction();
		session.startBatch();
		for (Map<String, Integer> map : mapList) {
			session.update(PREFIX + "updateClick", map);
		}
		session.executeBatch();
//		session.endTransaction();
	}

	public void updateCrawl(Book book) throws SQLException {
		session.update(PREFIX + "updateCrawl", book);
	}

}
